package com.caosy.grassthinkremote.common;

import java.util.HashMap;
import java.util.Map;

/**
 * 存放用户信息
 */
public class BaseContext {
    private static final ThreadLocal<Map<String,Object>> local = new ThreadLocal();

    public static void set(String key,Object value) {
        Map<String,Object> map = local.get();
        if (map == null) {
            map = new HashMap<>();
            local.set(map);
        }
        map.put(key,value);
    }

    public static Object get(String key) {
        Map<String,Object> map = local.get();
        if (map == null) {
            map = new HashMap<>();
            local.set(map);
        }
        return map.get(key);
    }
}
